* 0_Master
** Goal: Run all code needed to generate results for Clemens, Payson, and Veuger (2024)
** Beatrice Lee
** Date Created: 2023-10-18 
** Last Updated: 2024-07-31 // tja

set more off // continuous display (do not cut off output)
clear all // clear all results
matrix drop _all // drop all matrices
macro drop _all // drop all macros

set maxvar 3772 // set the max # of variables (this number is standard for this version of stata)

set type double

set varabbrev off

* Set macros and file paths

* uncomment the next line and add working directory inside quotation marks
* global dir "ADD WORKING DIRECTORY HERE/"

global Do "$dir/Do"
global Data "$dir/Data"
global Results "$dir/Results"
global Charts "$dir/Charts"

* If working with cleaned data:

* 3: 3_MainSampleResults.do
* Runs + exports main tables + scatterplots
* creates Tables 1, 2, 3, 4, 5, 6, and 7, as well as Appendix Tables A.1, A.5, and A.6
cd "$Do"
do "3_MainSampleResults.do"

* 4: 4_Scatterplots.do
* creates Figure 3
cd "$Do"
do "4_Scatterplots.do"

* 4a: 4a_GenerateMaps.R
* Generates maps for paper
* creates Figures 1 and 2

* 4b: 4b_RatioGubToSenNewsArticlesChart.R
* creates Appendix Figure A.2

* 5: Mechanisms_SummaryStats.do
* creates Appendix Table A.2
cd "$Do"
do "Mechanisms_SummaryStats.do"

* 6: Mechanisms_CampFinance_Overleaf.do
* creates Appendix Tables A.13 and A.14
cd "$Do"
do "Mechanisms_CampFinance_Overleaf.do"

* 7: Mechanisms_StateLegislature_Overleaf.do
* creates Appendix Tables A.8 and A.9
cd "$Do"
do "Mechanisms_StateLegislature_Overleaf.do"

* 8: Mechanisms_VoterTurnout_Overleaf.do
* creates Appendix Tables A.11 and A.12
cd "$Do"
do "Mechanisms_VoterTurnout_Overleaf.do"

* 9a: Mechanisms_MediaCoverage_Overleaf.do
cd "$Do"
do "Mechanisms_MediaCoverage_Overleaf.do"

* 9b: Mechanisms_MediaCoverage_Heterogeneity.R
* creates Appendix Table A.7


* Robustness checks and additional code files:

* Mechanisms_AdditionalStatewideElectionsRegressions_Overleaf.do
* creates Appendix Table A.10
cd "$Do"
do "Mechanisms_AdditionalStatewideElectionsRegressions_Overleaf.do"

* RBCheck_DropState.R
* creates Appendix Figure A.1

* RBCheck_IVLeaveOneOut.R
* creates Appendix Table A.4

* First_Stage_Senate_House_Separated.R
* creates Appendix Table A.3


STOP /* End */





